<template>
	<view class="wrap bgw">
		<view v-if="state == 0" class="lists_main "> 
			<view @tap="successs(v)" v-for="(v,i) in data" :key="i" class="list one">
				 {{v.name}} 
			</view>
		</view>
		<view v-if="state == 1" class="lists_main ">
			<view @tap="successsServe(v)" v-for="(v,i) in listServe" :key="i" class="list one">
				 {{v}} 公里
			</view>
		</view>
	</view>
</template>

<script>
	import {productCategoryList} from '../../api/api.js'
	export default {
		data() {
			return {
				data:[],
				listServe:[3,6,9,11],
				state:-1,
				pageable:{
					pageNumber:1,
					pageSize:20
				}
			};
		},
		onLoad(e) {
			this.state = e.state
			if(e.state == 0){
				this.init()
			}
		}, 
		methods:{
			successs(v){
				uni.setStorageSync('SuccessCategoryList',v)
				uni.navigateBack()
			},
			successsServe(v){
				uni.setStorageSync('successsServe',v)
				uni.navigateBack()
			},
			async init(){
				let data = await productCategoryList({
					pageable:this.pageable
				})
				this.data = data.data.content
			}
		}
	}
</script>

<style lang="less" scoped>
.lists_main{
	 padding-left: 30rpx;
	 padding-right: 30rpx;
	.list{
		height: 102rpx;
		line-height: 102rpx;
		padding: 0 10rpx;
		font-size:32rpx;
		font-family:PingFang SC;
		font-weight:bold;
		color:rgba(26,26,26,1);
		border-bottom: 1px solid #EEEEEE;
	}
}
</style>
